package com.jiapu.controller;

import com.jiapu.common.Result;
import com.jiapu.entity.Event;
import com.jiapu.entity.People_information;
import com.jiapu.mapper.People_informationMapper;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController

@RequestMapping("/people")
public class People_informationController {

    @Resource
    People_informationMapper people_informationMapper;

    @GetMapping
    public Result getPeople_information(){
        List<People_information> people_informationList = people_informationMapper.findAllp();
        return Result.success(people_informationList);
    }

    @PostMapping
    public String addPeople_information(@RequestBody People_information people_information){
        people_informationMapper.savep(people_information);
        return "success";
    }

    @PutMapping
    public String updatePeople_information(@RequestBody People_information people_information){
        people_informationMapper.updateByIdp(people_information);
        return "success";
    }


    @PutMapping("/del")
    public String deletePeople_information(@RequestBody People_information people_information){
        people_informationMapper.deleteByIdp(people_information);
        return "success";
    }
}
